//
// Created by Lenovo on 2020/9/28.
//
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
const int maxn = 1e5+10;
ll a[maxn];
ll sum[maxn];
int main()
{
    int t;
    cin>>t;
    int kcase = 0;
    while(t--)
    {
        int sta,stb,n;
        scanf("%d %d %d\n",&sta,&stb,&n);
        sum[0] = 0;
        for(int i = 1;i<=sta;i++)
        {
            scanf("%lld",&a[i]);
            sum[i] = sum[i-1]+a[i];
        }
        ll ta = 0;
        ll tb = 0;
        int pow;
        for(int i = 1;i<=n;i++)
        {
            pow = upper_bound(sum+1,sum+1+sta,sta)-sum;
            pow--;
            ll tmp = sta-sum[pow];
            if(tmp==0)
            {
                sta = pow;
                stb = a[pow];
            }
            else{
                sta = pow + 1;
                stb = tmp;
            }
            if(tb==stb&&ta==sta) break;
            else
            {
                ta = sta;
                tb = stb;
            }

        }
        printf("Case #%d: %d-%d\n",++kcase,sta,stb);
    }

}
